adding environ and logical handling of urls