Removed unnecessary for-loop in else if condition.