remove unused variable
refactor
remove useless variables
handle malformed uri