Added init target for 1st run.
Implemented most of (non-streaming) file api.