Implement reult range limit and automatic hiding of the dialog