Adding recursion for tick function