Clean up the code

Build without errors and warnings