Changed scroll painting function