[TIMOB-1300] Addressed comments in PR and made code more efficiant