Mode switching

@sunesimonsen and I refactored much of the code to make mode switching possible.

As a result of this change it will be trivial to extend knockout selection with new modes - as the toggle and off modes that we will introduce shortly.

(This version features less changes to indentation than #60)