cleaned and optimised