use threads to reduce total query time
remove unused heroku stuff
add some logging