Typecast MALLOC_TYPE return value for better type safety
Tiny fixes to MALLOC_TYPE comments
Move to CPM infrastructure, improve MAX, MIN