first commit functional mercury code.