Refactored
Fixed indent
Added test