added dialog and location checking