Finish the initial coding

The initial coding has been finished without testing and debugging,
pending the availability of the matrix files.