[EpgSelection] major code cleanup and optimisation.