[PATCH v2 16/32] Move self-isolation code into a separate file