Fixed StyleCop and compiler warnings