add multithread trainer + code refactoring