Refactored my code.