updated code to parse q in url