changes to more object oriented way