cleaned up code in archive.php
refactored code in category page