Moved Stack class definition for the sake of organization