Documentation and refactoring.

Removed all the io:format calls and replaced them with calls
to syslog (if important enough).