add change_algorithm and its tests plus draft of change_machine