made q a maximum of 2^128 as per spec