added functions to find distance and edge position

also added error messages to be thrown