cleaned up the way the function is called a bit