Create subpackages

This PR builds on PR #16, so please delay merging it until that has been merged.