Refactor types into Internal modules so that we can have custom fields in models