More refactoring: introduce an interface layer to ease testing
reduce use of magic string in tests