More database stuff

Also some UI enhancements as well