Implement generate_init and tests