use child(index, selector) instead of firstChild/lastChild
improve javadoc and code style