Logic error
Refactor