better resource registering pattern