breaking up methods and adding java doc