Improved use of monitors

Improved use of monitors via wait() and notify() and remove superfluous code