Refactor code that writes out the runtime