Card parsing and code cleanup