Improve filesystem code structure
Remove redundant error checking
Cleanup filesystem operations and add proper error checking