refactored at bats into separate function