Moved code to class