Add separate license file and better thread safety