Added type inference (incomplete)