refactoring/sanitizing puppet code