close read fd; add comments; modulate server code