Render refactor (with couple of fixes)

Again, using tabs for formatting makes these look weird on GitHub (and other IDEs).