extract city extraction code into method