Refactoring the code to make use of the CurrentUser class