Dan's added sql db stuff