this version works but memory limited; keep devthres >35