More cleaning up of code