modified code to make one page app