Adding copy of Project 5, modifed for project 6 (added raise event)