#8: Using app factory pattern again to ease unit testing.
Moved setup() to commands.py
Fix #8: Added basic unit test.