Refactor. Fixed assertion.