better error handling
more docs for help to understand code until refactor