Refactored to simplify the interface