set up proper function queuing