MOC function is completed. need to make input and output files better.