Clean up some code issues