putting into a function to apply