improved to parse url and file path