trying to make data available in function