Update compare.php

Refactor compare.php