Lots of cleaning in code