Store PHP errors in an array instead of a flat string, format at output time
Use the 'nsi' prefix for internal functions