creted methods and wrote javadocs