improve limits.c, expand.c, add Makefile
small fixes