Added 3-arg mode and made sure that base or location must always start at valid URL