Removed unused stuff
Renamed fs to filesystem
Added additional error checking