added docstrings and started file input/output functions