changed code to object oriented
changed code to object oriented