all working
all working
refactored