Support for logging and verbose modes
Up-to-date and cleansed version
Added support for logging and all round error catching