pw-algorithm works correct; threading doesnt work yet