Fixes multithreading
Minor fixes
PEP8 (2-space indentation kept)
Indentation changed to 4 spaces