GH-13: Started refactoring and preparing for unit tests.