added config and improved url parsing