Split into modules

Closes GH-3