SHAFI
second commit with refactored code
cf4e4d4