Code cleanup & optimisation.