TMDM-7456: code refactoring & cleanups