changed the termnate() function to stop FFD safely
Deleted unused function
Deleted unused function
update the order
Reformatted return