cleanup level.cpp a bit