fixed some shell escaping bugs and added some code comments.... 8 dollar signs for proper escaping. 8