Trying select() instead of threads