using dialog to catch errors and proper way of using markers in maps