Finish main fuctions without debugging. Add commments

Finish RMR,RMT,RMRT. Modify format. Add comments to generalization.py.