there are some intendation errors on these lines (the else and end 's for the if 's)