refactor and update
Support backwards compatibility
Merge pull request #4 from samuelcouch/refactor

Refactor