Reorganise the constructor to improve performance.