creat hsdatabase function
define typeDetector function