refactoring: reordering and more short version of _clear_ function