refactor of type systems