Modified to use file input port to read cache (for less memory).