made a lot of changes mainly to fix the authorizarion issues