Clever way to handle all the conditions.