General cleanup of code, change notices to debugs, extract string repeat into a reusable parser function rather than using inline template