Removing duplicate close.
Adding javadocs and minor code clean up.