initialize everything at the right moment