CDI fixes & refactoring