Refactored how we use states so that they are not static