Creating function that estimates current position.
modifing main script.