Datatype refactoring