Reorganise code to be free of orphan instances