Refactor tabs into their own module.

Fixes #49.
Fixes #44.