Add ability to register custom package repos

In this pull request I've also refactored the code to fix #106
I'm testing using the Jenkins CI repository.