modularize

fixes #2