finished modularization. closes #2