Added more conditionals to allow for weird short paths.