Implemented basic type inference