changed rendering code to render images