add checkstyle, added javaDocs and small changes to code