code refactoring. routes now handle files