refactor to store metadata in objects