Updated locking method
Fixed typo in read_package_name function
Added LINK_CACHES option to decide whether or not to use linking
function.
Moved finding a repo from a path/package out to its own function
Added some extra debugging