Final non-OOP version