Fixed order of FIFO opening and pid writing.
Rewrote structure to run certain code only if the current process is the server,
and run other code if current process is one of the child client-servers.
Added a comment