semi-done some parts on analysis