Some general code clean up