F1: Make code refactoring.

Refactored Thread and Application.