Refactoring code so server code is more independent of sampling and adding a CLI. CLI still has URL of server hard-coded