make gestate interchangeble with a mock function for testing