improve grep script