Rewrite getHistory and logout functions