functional version
Merge pull request #12 from weverett/MA

Finished refactor