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