calculating speed before position seems to be better