refactor bind code to reduce repetition