Cleaned the code

As the title says, I cleaned the code removing unnecessary whitespace, using LINQ for some manually created loops and made the code more robust and less prone to errors. However, I had some trouble with the .gitignore which is why there are SO many files affected by the pull request. (which were mainly files from the obj / bin-directories)