starting to rewrite pv array code