Remove unused function
Extract dialog code in to a module