better error handling and url encoding management
missing import