remove redundant code and optimised imports