split into smaller units. fixes #1