Pull the majority of the implementation of the rendering package into a library for better compile performance.