made leading and trailing slashes optional