Added all the functionality to index.xhtml