Clean up code to meet best practices