algorithm works, need to fix connection to class