Refactoring again + MasterThread class