Added perimeter function