Changed to more procedural nature