Extract defined function to be reused in line and area