refactored implementation for src java