More testing - better template use and db functions