add tests
modify code to make app testable