Fix all of the grammatical problems in the following paragraph:
He was very offended with that as he was going to finish his work and to switch on lights.
He was very offended by that as he was going to finish his work and switch on the lights.