Implemented using threads. Corrected HTTP error codes and fixed some
coding style.