The current implementation has three classes of flags: - readFlag - delFlag - flaggedFlag The logic to check for them should be in parallel if branches rather than in sequential if-else ladder.