Adding pushpin code moved to separate function