updated method names to use capitals, pulled out buffer code from decoder