simplified some code trough thread-last