moved timer logic into a directive