moving over to using a callback function due to flexibility