changed to backtrack func, doesnt work