refactory, adding unit tests, adding new model to reflect table
structure