Clean up code and fix all compiler warnings.