refactor into metadata method