More clean up. Wrote some tests. TODO: Swap all hardcoded hosts and paths with config objects