Removed some dead commented code and unused imports.
Added -notify.
Fixed some bugs.
Refactoring.