improved connection handler; removed commented and unnecessary log code;