refactored card div creation