tons of refactoring with templates to replace copypasta.