Add better module and class factory management