refactoring variable assignments

Trying to reduce complexity and repetition in Commissioning service