Export module cli from main module.

Start modulazition to get cleaner and testable code. Added tests for the cli module.