improved area function