added basic functionality of open, close, read and write