Wrote structure for database.js - TODO: sorting and cookies