Added simple event system and threads