unused
refactored and commented