Update index.php

Added fix to use proxy , code restructure and formatting