refactored with current implementation