Refactored shell and filemap. I hope it's still working.