easy to test -- run test.sh
refactoring