swapped condition logic for better readability