refactor ODM code, simplify the Generics structure