Fixed StyleCop stuff and some exceptions

Also removed unnessecary code