Cleaned up rendering code.