moved code
more refactoring
more dialog magic