debug legality testing and move factory