Fixed another overflow bug, cleaned up code, fixed compiler warnings