adds caching for performance
adds function which returns the format string, this to further modularize the functionality