Somehow I feel this code is a bit ugly. it's especially unclear that $p1->[1] is nick after the refactor. Wondering if we can do this in a bit clearer fashion.