Refactor for flexibility