added error handling and a href attribute (fixes #9 and #10)