TMDM-7456: clean-ups and code refactoring