fix open file when file doesn't exist, and modify readFile/etc to use new implementation
refactoring libraries