Reworked the w memory to use a circular buffer with 16 words.