Split the code up into modules.

Also: PYTHONPATH in general is unintuitive.