added better logging and sockettimeout.