protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{		
		if (active(request)) //if there is an active user
		{
			if (request.getRequestURI().equals(request.getContextPath() + "/profile")) //if there is no string after profile/
			{
				//current user, personal profile
				
				request.setAttribute("pageTitle", "My Profile");
				request.setAttribute("profileUser", user);
				request.setAttribute("publicProfile", false);
				request.setAttribute("following", followingCount(user));
				request.setAttribute("followers", followersCount(user));
				request.setAttribute("blabs", blabCount(user));
			}
			else
			{
				//other user, public profile
				
				//get the username of the profile you wish to visit
				int last = request.getRequestURI().lastIndexOf('/');
				String uri = request.getRequestURI().substring(last + 1);
				
				String email = profileMain.getEmail(uri);
				
				User profileUser = profileMain.getUser(email);
				
				if (profileUser.getEmail() == null) //if the user does not exist
				{
					request.getRequestDispatcher("/404.jsp").forward(request, response);
					return;
				}
				
				if ((profileUser.getEmail()).equals(user.getEmail())) //if the current user tries to access their public profile
				{
					response.sendRedirect(request.getContextPath() + "/profile"); //redirect to personal profile
					return;
				}
				
				request.setAttribute("pageTitle", "Profile: @" + uri);
				request.setAttribute("profileUser", profileUser);
				request.setAttribute("publicProfile", true);
				request.setAttribute("alreadyFollowing", alreadyFollowing(request));
				request.setAttribute("following", followingCount(profileUser));
				request.setAttribute("followers", followersCount(profileUser));
				request.setAttribute("blabs", blabCount(profileUser));	
			}
			
			request.getRequestDispatcher("/profile.jsp").forward(request, response);
			return;
		}
		else //there is no active user
		{
			response.sendRedirect(request.getContextPath() + "/login");
			return;
		}
	}