a lot of changes made
fixed with threads