refactor, add java doc