refactored out passing in the user object, state functions are now invoked in the User context