Refactor for Java use