refactor data using metadata