Removed global and added dependency injection to user class