Reorganisation of code