Some cleanup and fix all compiler warnings