Adjust code format and tweak some parameter type