Some cleaning up in the code