Completed the basic interface.
Almost completed, still remain cost function.