fixing compilation with gcc, using -std=c99
don't try to be a smartass with sizeof()
fetching all the keys once
adding worker threads