added more to the rendering function and fixed a function in the mesh class