Added map popup feature and condensed functions