masukomi, today is, apparently, a "sorry but i couldn't not refactor your code" kinda day.
it's not bad code (mostly) it's just.... it could be a lot easier to understand, and thus maintain, and if i'm going to have to spend the time figuring out wtf it does i might as well save the next person the same trouble.