Change hardcoded directories to puppet_vardir fact
Add more error checking