a whole lot of refactoring to get complete java api...