Support Cmd+Up/Down, Ctrl+Left+Up/Down scroll modes.

Optimize and organize code a little better.