Added settings dialog some code improve