added removel of trailing slash, and also double slashes