Fixed error in level drawing and added a system for writing logs