Implemented the restrictRead function