More cleaning up of the code