code cleanup/optimisation of the code