Added logging and some more grouping logic.

Just realized I've been using two space indents the whole time.
Next commit will fix this.
Oops. But seriously, it's totally vim's fault. <_<