reader complexity reduced
added tests for errors