refactor to make intent more clear and improve code climate score