Adding generate function to GUI.