refactor java to D