more refactoring to get it running on local.