split the algo into 2 files