refactoring of service conroller and fix bug in the class provider