add firstChild and lastChild support. code review comments.