Restructured to class and event based structure.