added update position function