First try, procedural style