refactor for testing and write a couple of tests