Split out math functions
Simplified repeated key checks

Lots of duplicate code - I'll probably keep OptimizedKeyboardManager and
InjectableInputManager.  The rest are needless abstractions.
Misc housekeeping

Sorting and copying for lists

Cut out the dirty flag for widgets