Added area sort function.