condensed code for cat.c