added stripping of leading and trailing whitespace from titles (thanks Mario Vavti!)