Rewrite the card adapter

Signed-off-by: Umair Khan <omerjerk@gmail.com>