refactoring. documentation
roll back if fetching metadata failed