add debugging info, some proper malloc'ing