public T decode() {
		while(preservePair || data.parse()) {
			preservePair = false;
			if (data.headerEquals(GenericFixFiller.beginString)) {
				if (msg == null) {
					// new message found
					// TODO change to filler.newObj(String type) 
					msg = filler.newObj();
				} else {
					// we parsed prev message, but found beginString. 
					// return prev message and do not parse for pair next time
					preservePair = true;
					T r = msg;
					msg = null;
					return r;
				}
			} else if (msg == null) {
				// found strange data without begin, skip it
				// TODO possibly create message with errors?
				continue;
			}
			filler.fill(msg, data);
			if (data.headerEquals(GenericFixFiller.checkSum)) {
				//found end of message. reset current msg and return it
				T r = msg;
				msg = null;
				return r;
			}
		}
		// we didn't find anything in current buffer, we need new one
		return null;
	}