Refactored
Added answer
Added test