GWTII-187 refactored code