improve db stuff slightly