Added several new utility functions, support for :pre and :post hooks and lots of tests