Refactor for cleaner design