Refactoring: clearer code
Added test