misc caanoo related code, mostly terrible