Added writing and reading index from disk functionality