added else at end to exit properly