Tidy up optional mapping
Tidy up query string generation