adding tests
and fixing minor bugs
adding better formatting for output
adding log_critical (:= log_fatal)
updated documentation