add define to switch between single and multipacket builds
change loop behavior for single packet mode