Cleanup and code formatting