configuration class and some rearranging