Bug fix to correct for firebase warnings

turned out to be a capitalization issue from before we added rules.
Other minor refactoring as well.