cleaned up code, made small changes in the way FileSystem is used