added more to the build_query function