cards view bug fixed and minor code improvements