Mostly working
Refactored database, moving firebase queries to backend