modified function creation to be more consistent