corrected id names
corrected validation function usage
corrected urls
corrected option name and moved helper function
check for main query
use more helpful defines for including to reduce chance of errors