refactors procedural code with a new generic service class and service enumeration classes.