many speed improvements, fix animate factor calculation and test