seperate delegate into its own function