Re-organisation of the code