Added typehints and passed value by reference.