creating new nodes as interval ends
updated version