refactor card class