General clean-up of code