Changed code to class