use timer instead of threads