added logic for positions