Cleaned up model code and tests
Merge pull request #5 from dkumar/refactor

Cleaned up model code and tests