Changed to buffer up to 16 values
Cleaned up and documented somewhat