Added javadoc style comments to many functions.
Modified server constructor to reduce code redundancy