implement istanbul, based on @gotwarlost PR