Refactor data collecting and database classes to work with images