refactored to allow custom semantic class to be injected