cleaned up comments, added array.shift to keep the msgs array small