added else clause to catch unexpected conditions