reorganising the code