Updated many codes, added comments.