finally working now ready to integrate in the reader