Internal functions for the doBy package