add generic type inference