Refactoring of types and utils