Reimplemented CGrep.java