Cleaned this class up, implemented javadocs and fixed checkstyle warnings