Moved date tree construction into controller