refoldered based on dickeys finished code. starting from scratch; first must echo package json