Add static memory functions
Centralize format string manipulation

Downside is that it now uses malloc