refactoring

part of the previous commit