better style. Do not try to set default path after opening image
remove unused function
simplify events