tweaked complicated piece to add a function call