working on length-of-perimeter function