Refactored to use interfaces