Implmented control margins.
Refactored the GUI manager and input manager.