Add input namespace to track keyboard and mouse events
Reorganize code a bit