Add alternative code motion algorithm and tests for it.