Fixed Jeff's bugs

This push also includes abstraction of file and dirs, no longer need
separate vars and functions for both.
Fix Dan