Refactored render() function into a superclass method.