Changed double to float
Implemented main_cp partially