Add pmap, atom and tree structure for multithreading