Node cleanup, tests, better exception handling