Major functions are implemented

It should run with no big problem now.
 But bugs may exist, with high probability.