added todo: threading improvement