Apart from your question here, consider submitting your code to codereview.stackexchange.com, read their site guidelines first though! Point is, there are a few things to improve outside of your question. That said, put your code in triple backticks followed by the language to get the proper syntax highlighting here. I already tweaked that for you. —
Ulrich Eckhardt just now