Making index page able to handle code properly