minor syntax changes, still derp pseudo code