all seems set up, lets turn this into a function