Renamed target to end and reversed path, also made -1 get passed into config rather than blindly continuing