Fixed minor typos and updated to correspond to latest version of code.
Added error-logging functionality, should eventually be used by all files.