JAL-652 further refactoring / tests