first test + impl for read()
integrating read() into main() function