fixed bug with 'thistype'

now shares code with finding type for 'this'
logging