added verbose debugging messages, fixed a problem with source string construction