fixed read function now that i have hardware to test with