[PLAT-6444] Refactored conditional blocks as per code review