refactor

smaller code, avoid function.call when possible