Added lots of business logic

- Added unit test