Refactoring IoC into separate object, and improving test coverage.