Refactor to simplify code
Fixed names