Updated grepping code