added the user state in every page and cleans the code