There's some complicated stuff happening here, could use some more comments