included changes from robisaacnz