It looks like your indentation is messed up, which may be what's confusing you. Double check that -- consistent indents are a good way to tell if you're missing an `end` somewhere.