refactor generic types