Tried using the isLocationOnEdge function but it's not working :(