Added endif and fixed syntax error