using elsif instead of else to properly catch this condition