Added title to dialog and fixed bugs.