Continued cleanup, fixed multiple issues with createAvsFromTemplate.