Reorganising the code a bit