some optimisation added. ~10fps on tab