refactering getvartype