Fixed compiler warnings & misc cleanup