Refactor card_converter to make less queries on the database