extract function tweaking