added a bunch of options and improved grepping efficiency somewhat