Cleaned up some code. Added a couple checks to make sure a file is accessable.
More work to be done but this is a safe version 1.0