merged in lucasnz fork