refactoring for Bogdan's changes