Luan's algorithm finished