Cleaned up bugs in title detection code