Some improvement in rendering

Some fixes to speed up rendering of the background