changed position calc to avoid duplicates