Implemented get_sub_slp and reduce