Simplify logic as per Alex suggestion.