initial code extracted from generic sections of places engine