Refactored to maximize reuse