changed setTimeout to rAF