simplifying the logic