sort things around and add autopair