Making it functional and OOP