add recursive version
add javdoc comments