fixed some typos, re-arranged some parameter lists for functions
fixed some function to re-arrange parameter lists for functions