reorganized if-else condition.