Integrate changes from idearat fork.

Added support for better grep, fixed cp bug.