Adding cgregg's changes.