better errors
refactoring