move some code to body to avoid blocking