Missing end brace in function