reworded the function