if (timer!=null)  - simplified