bug fixes and general interface cleanup, added pretty print as well