added an area function with optional edge pixel exclusion