Try to make the logic more readable