Added basic InputCache, needs further refinement.