Separation of business logic and command line program

Separated the business logic from the command line program. Now peerflix can be used as a standalone Node.js module.