changed functional to procedural