Рефакторинг.

Signed-off-by: Ilya Petrash <gil9red@gmail.com>