Move functionality generic for all buffer checking methods into separate method