Rewrote the input manager to use listeners and the functional library.