Fix some bugs, add an event system and implements a progressbar.