Refactor for cleaner solution