Moved template setup to database