Added writing and reading test. Still a bit unstable.