Refactor to periodical tasks