Replaced event system by a new one written in C++11. Updated all code to work with the new event system