no ifs solution refactored

tried to make it easier to read