refactoring to split into readability specific work and rendering specific work
Refactoring rendering functions so they access a passed pointer and return a new pointer