restored title grabbing function to original code