added a custom payload option and refined the way the payload path is
determined