Converted to object oriented style