Updated the publish algorithm to deal with deps