Started adding godoc to make this code a little easier to decipher