added and tested edge existence check