fix offsets, error codes, logging, all output to single dir
output and temp file management; fixes #2