refactored, final version 1
refactored, final version 1