Adding position function