Initial rewrite of profile page js for loading bar