Added dialogue functions, replaced alert()