General code clean up