Added read and write functions, not finished