Change code to be more streamlined, and to allow reading from read-only directories without exceptions