patched in Nathans refactoring
Merge pull request #7 from nikhilRP/refac

Patched in Nathan's refactoring