Now added more functionality to improve the image rendering