Final code. Cilk still under development