Refactored solution to match standards