Added object oriented version