Reorganise code base