Add first unit test. Refactor to simplify app.