COMMON: reorganise code