Please ensure that whenever you post any code, you do so in the format that the forum expects, otherwise other forum users will no be able to assist you.
See this post;
Instead of reposting your code again below, use the pencil icon in your post above and edit it as per the sharing guide.