fixing memory leaks, refactored input processing
starting hud refactoring