tidy code for rebinding following code review