Fix parameter position, remove unused codes, and format some.