ass old J algorithm