Generate and write features