ending nodes correctly now