better error handling and properly aligned url params