Minor refactor. Tested with EE 2.9.