Implemented gauge transformation, cleaned size_t comparison warnings