Refactor index.php
Fix third query