TMDM-7478: code refactoring and clean-ups