simplify coorditnates calculation