refactoring, added alarm manager and periodical updates, fixed lot of bugs