add file access and remove a lot of old code