Add javadocs and rename some variables

Signed-off-by: Ian Macalinao <ianmacalinao@gmail.com>