Added extractTitle function