three layer
works!
un vectorized version works. going to vectorize it