refactor directory/file to json encoding; remove extaneous function