Code optimizations (from 30fps to 45fps on ipod 4!)