Converted to Magento Shell Script