copied over logic to new proto class