added print_lines method
hopefully fixed unicode error problem
made test_query into one-off query method