Use GSList functions instead of manual iterations