Fixes #6 (title elements not being stored correctly) and simplifies getTitle function.