updated rendering code