had to use ref and not this