Minor refactoring

Signed-off-by: Kirill Zotkin <kirillzotkin@gmail.com>