I'm not exactly sure what this is doing, but there is probably a better way to do it...