[TIMOB-13118] Bug fix and code cleanup