Fixed gendarme, compiler and StyleCop issues