refactored code and give test a better description