completed source. added tests. refactored project structure