Rearrange the project

Rearrange the project to have a static lib for the cli app so that we can write tests for the command code.