cleanups and switch pkg.sources back to array from object to guarantee ordering