add function for calc pos