The reason why this is giving you so many errors is because the code contains them. Starting with a missing curly at the second line, continuing with a missing bracket...