Added friction and modified the updatePosition routine