Removed the looping through all files, was unecessary, cleaned up and added comments