What's going on here? There should be more comments in the code describing what and why this is.