Fixed a bug that caused exception if the value was empty and should be pretty printed. Also improved documentation and logging.