updated to add buffer support and rewrote to take an object instead of params