Replaced generic exception

Replaced ArgumentError with Buffer::InvalidToken
Refactored buffer methods

Extracted methods into helper methods
Moved code towards single responsibility principle