learned refactor and test, sample app