Cleaned code and renamed events