thanks to Megabyte777. added constants from limits.h. added malloc wrapper