starting to make playable again. refactor debug mode