Add end statements to fix syntax error.