Refactor for better design and making future changes easier