fixed html and better output
uses better string checking