cleaned up some code, fixed all warnings