Creates function that initializes the resources.