Did some minor cleaning up of the code