please replace by a one liner using numpy's vector/list operations as above, its too hard to read this way