Update formatting
Refactor interface for easier testing