Copied over assignment 2 code to use w/ pub/sub stuff