Add inputcache, pass all tests