Added else case for more stable operation