Refactor and add puppet validate