Refactor contracts and tweak design for dependency injection (breaks build)