Refactoring rendering with file scope; in progress