Added chain code and perimeter