refactor nearly complete
Refactor complete
Assertions added