Refined functions in chapters 3 and 4