clean up code and refucktoring