Final clean up of code