if statement refactor to match code style