dispatch code in different functions to help override