use numpy array as much as possible