some code refactoring from 03.12