moved timer outside