Minor change in function name.
Fixing some bug and removing unnecessary constants.