changed my threads

made code more flexable