Make write method part of toalist class.