Handle possibility of @filetype not being defined more elegantly.
Fixed the system file test and setup, and removed some helper code that's no longer needed.