Implement some database stuff