Refactor threads' expanding