Added args checking for dependency references
Changed the register API

The register API now takes the definition as the first argument to stay
consistent with the load and provide methods.