Move helpers.go content to misc.go

There's really no reason to have two separate files for miscellaneous
stuff. Also, rename helpers_test.go to misc_test.go

Clean up the loop GetPageID and improve safety. If the query, pages
field cannot be asserted to a map, return an error instead of failing
stupidly.