in reply to will not compile

I think it's a typo: use $typeIn instead of typeIn everywhere.