Improve instruction reader and add tests