adding node logging and better error handling