Refactoring
Added test