Did some major fixes and multi threading.