refactors errors
refactors assertions