second attempt at backtrack