removed useless thread, unused variables and imports