Second bulk of refactoring. Separation, configuration, retab.

Signed-off-by: Kirill Enykeev <enykeev@gmail.com>
Tests for second bulk

Signed-off-by: Kirill Enykeev <enykeev@gmail.com>