Add type regexs
Added nane validuty check
Reorganize so functions are in class