changed second statement to else instead of if