Added event scheduler, fixed bugs