-Refactored code to reduce common repeated code.