rewrite o4-context, use arrays instead of linked-lists to achieve better performance.