Changed resource handler to work with promises instead of callbacks