simplify card and add unit tests