add function to marginalize tub
add func to all
fix to only run on running