Refactoring note functions and stackTraceFromError function.