General cleanup.

Will be working on handling HTTP errors and leftover half-downloaded packages in upcoming PR.