Starting to refactor and get ready to write tests.
First simple testcase.