Code refactor.

Signed-off-by: Mariusz Fik <fisiu@opensuse.org>