i'm actually angry at how poorly this code is commented