make more variables const to help the compiler
remove unmodified function