performance improved using numpy structures