start modularization
added tests
further work on modularization + testing