improve positioning algorithm